package edu.cuit.zhuyimeng.flight.controller.vo;

import com.fasterxml.jackson.annotation.JsonIgnore;
import edu.cuit.zhuyimeng.aircraft.api.dto.AircraftInfoDTO;
import edu.cuit.zhuyimeng.framework.common.util.TimeUtils;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;

import java.io.Serial;
import java.io.Serializable;
import java.util.Date;

/**
 * 航班信息VO
 */
@Getter
@Schema(name = "FlightInfoVO", description = "航班信息VO")
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class FlightInfoVO implements Serializable {

    /**
     * 航班ID
     */
    @Schema(description = "航班ID")
    private Long id;

    /**
     * 航班号
     */
    @Schema(description = "航班号")
    private String number;

    /**
     * 预计起飞时间
     */
    @Schema(description = "预计起飞时间")
    private Date startTime;

    /**
     * 预计到达时间
     */
    @Schema(description = "预计到达时间")
    private Date endTime;

    /**
     * 出发城市
     */
    @Schema(description = "出发城市")
    private String deployCity;

    /**
     * 到达城市
     */
    @Schema(description = "到达城市")
    private String arrivalCity;

    /**
     * 开放订票时间
     */
    @Schema(description = "开放订票时间")
    private Date startBook;

    /**
     * 结束订票时间
     */
    @Schema(description = "结束订票时间")
    private Date endBook;

    /**
     * 航班状态码
     */
    @Schema(description = "航班状态码")
    private Integer status;

    /**
     * 航班状态信息
     */
    @Schema(description = "航班状态信息")
    private String statusInfo;

    /**
     * 价格
     */
    @Schema(description = "价格")
    private Integer price;

    /**
     * 飞机信息
     */
    @Schema(description = "飞机信息")
    private AircraftInfoDTO aircraftInfoDTO;

    @Serial
    private static final long serialVersionUID = 1L;

    @JsonIgnore
    @Schema(hidden = true)
    public String getCacheKey() {
        return TimeUtils.gerLocalData(startTime) + "-" + deployCity + "-" + arrivalCity;
    }

}
